import type { RecipeParams, RecipeItem, RecipePageParams, RecipePageResult } from './model'

const path = '/api/food/recipe'
export const recipeAPI = {
  search: (data: RecipeParams) => {
    return useCustomFetch<RecipeItem[]>(`${path}`, {
      method: 'GET',
      params: data
    })
  },
  page: (data: RecipePageParams) => {
    return useCustomFetch<RecipePageResult>(`${path}/page`, {
      method: 'GET',
      params: data
    })
  },
  detail: (id: number) => {
    return useCustomFetch<RecipeItem>(`${path}/${id}`, {
      method: 'GET'
    })
  }
}
